<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class LandlordAction extends CommonAction {
    public function _filter(&$map) {
        $key = trim($_REQUEST['keywords']);
        if(!empty($key)){
            $map['note'] = array('like',"%".$key."%");//备注信息
        $room_id = M('Room')->where("room_no like '%".$key."%'")->field('id')->findAll();
             $room = array();
             foreach ($room_id as $key => $value) {
                 $room[$key] = $value['id'];
             }
             $room_id = implode(",", $room);
             if(!empty($room_id)) {
                 $map['room_id'] = array('in',$room_id);
             }
        $map['_logic'] = "or";
        }
    }
    

    public function _before_add(){
        $this ->assign('hotel',M('Hotel')->where('status = 1')->field('name,id')->findAll());
        $this->assign('rooms',M('Room')->where('status = 1')->findAll() );
    }
}
?>
